import type { TableData } from './homeTable.ts';
interface Res {
  status_code: number;
  status_msg: string;
}
type BlockType = '' | 'cn_industry' | 'cn_concept';
interface HomeDataReq {
  block_type: BlockType;
}

interface HomeDataRes extends Res {
  data: {
    date: string;
    short_rank: TableData[];
    medium_rank: TableData[];
    long_rank: TableData[];
  };
}

interface DetailReq {
  market: string;
  code: string;
  date: string;
}

interface DetailRes extends Res {
  data: {
    market: string;
    code: string;
    name: string;
    turnover: number;
    add_date: string;
    turnover_percent: number;
    rise_range: number;
    rise_range_rank: number;
    rise_range_rank_change: number;
    g_percent: number;
    g_percent_rank: number;
    g_percent_rank_change: number;
    n_percent: number;
    n_percent_rank: number;
    n_percent_rank_change: number;
  };
}

type RankType = 'short' | 'medium' | 'long';
interface HistroyReq {
  rank_type: RankType;
  block_type: BlockType;
}

interface HistroyRes extends Res {
  data: {
    date: string;
    list: {
      market: string;
      code: string;
      name: string;
      turnover: null | number;
      turnover_percent: null | number;
      value: number;
      rank: number;
      rank_change: number;
    }[];
  }[];
}

interface HistroyDetailReq {
  rank_type: RankType;
  market: string;
  code: string;
}
interface HistroyDetailRes {
  data: {
    date: string;
    rank: number;
  }[];
}
export type {
  RankType,
  BlockType,
  HomeDataReq,
  HomeDataRes,
  DetailReq,
  DetailRes,
  HistroyReq,
  HistroyRes,
  HistroyDetailReq,
  HistroyDetailRes
};
